﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Pap.Data;
using Pap.Web.Utils;

namespace Pap.Web.Modules.Reports.ViewModel
{
    /// <summary>
    /// 
    /// </summary>
    public class AccountantMonthlyReportViewModel : IViewModel
    {
        /// <summary>
        /// 
        /// </summary>
        IReportRepository _ReportRepository;
        /// <summary>
        /// 
        /// </summary>
        IAdministrationRepository _adminRepository;

        /// <summary>
        /// Initializes a new instance of the <see cref="AccountantMonthlyReportViewModel"/> class.
        /// </summary>
        /// <param name="reportRepository">The report repository.</param>
        /// <param name="adminRepository">The admin repository.</param>
        public AccountantMonthlyReportViewModel(IReportRepository reportRepository, IAdministrationRepository adminRepository)
        {
            _ReportRepository = reportRepository;
            _adminRepository = adminRepository;

        }

        /// <summary>
        /// Gets the accountant monthly data.
        /// </summary>
        /// <param name="month">The month.</param>
        /// <param name="committeeId">The committee ID.</param>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public IEnumerable<IVMonthlyAccountantReport> GetAccountantMonthlyData(Guid committeeId, int month, int year)
        {
            return _ReportRepository.FindMonthlyAccountantData
                (u => (u.InstallmentDate.Month == month && u.InstallmentDate.Year == year)).ToList();
         
        }

        /// <summary>
        /// Gets all committees.
        /// </summary>
        /// <returns></returns>
        public IEnumerable<ICommittee> GetAllCommittees()
        {
            return _adminRepository.GetAllCommittees();
        }
    }
}